
var flushFlag=0;var getLimit=0;
function getWechat(flushFlag){
	getLimit=getLimit+1;
	$.post(localStorage.apiUrl+"content/wechat/jsSdkConfig",{"url":url,"flushFlag":flushFlag},function(data){
		if(Number(data.success==1)){
	   wx.config({
         debug: false,
         appId: data.data.appId,
         timestamp: data.data.timestamp,
         nonceStr: data.data.nonceStr,
         signature: data.data.signature,
         jsApiList: [
          'onMenuShareTimeline',
          'onMenuShareAppMessage'
                    ]
		})
	wx.ready(function(){
      wx.onMenuShareAppMessage({
      title: localStorage.shareTitle,
      desc: localStorage.shareContent,
      link: localStorage.webUrl+"content/basActivity/indexWechat?activityId="+localStorage.activityId,
      imgUrl: localStorage.shareImg,
      trigger: function (res) {
        // 不要尝试在trigger中使用ajax异步请求修改本次分享的内容，因为客户端分享操作是一个同步操作，这时候使用ajax的回包会还没有返回
      },
      success: function (res) {
	
      },
      cancel: function (res) {
  
      },
      fail: function (res) {
       
      }
    });
  


  // 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口

    wx.onMenuShareTimeline({
       title: localStorage.shareTitle,
      link: localStorage.webUrl+"content/basActivity/indexWechat?activityId="+localStorage.activityId,
      imgUrl:localStorage.shareImg,
      trigger: function (res) {
        // 不要尝试在trigger中使用ajax异步请求修改本次分享的内容，因为客户端分享操作是一个同步操作，这时候使用ajax的回包会还没有返回
      },
      success: function (res) {
   
      },
      cancel: function (res) {

      },
      fail: function (res) {
     
      }
    });

   });
  wx.error(function (res) {
		if(getLimit==2)return;
		 getWechat(1);
});	
		

		}
		else{	
		}
	})
}
getWechat(0);	




